package io.github.xxyopen.novel.dto.resp;

import cn.hutool.core.util.ObjectUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 数据分类搜索响应
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BookClassifiedSearchRespDto {
    @Schema(description = "书籍id")
    private String bookId;
    /**
     * 书名
     */
    @Schema(description = "书名")
    private String bookName;

    @Schema(description = "排序")
    private Integer sort;

    public Integer getMatched() {
        return  ObjectUtil.isEmpty(this.contents)?0:contents.size();
    }

    @Schema(description = "匹配数量")
    private Integer matched;

    @Schema(description = "内容列表")
    List<NovelInfoRespDto> contents;

}
